-
Notifications
You must be signed in to change notification settings - Fork 19
PR 155 - arithmetic expressions #275
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
wolfv
wants to merge
22
commits into
main
Choose a base branch
from
claude/review-pr-155-conflicts-011CV1dUir3JbwLdVJdKj2mH
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
PR 155 - arithmetic expressions #275
wolfv
wants to merge
22
commits into
main
from
claude/review-pr-155-conflicts-011CV1dUir3JbwLdVJdKj2mH
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Merge branch 'pr-155' to add support for unary arithmetic operators including increment (++) and decrement (--) in both prefix and postfix forms. Resolved conflicts in: - parser.rs: Unified UnaryArithmeticExpr structure with Pre/Post variants - execute.rs: Updated evaluation logic for new operator structure - types.rs: Added unary_op method for pre/post increment/decrement The implementation now supports expressions like: - ++a (pre-increment) - a++ (post-increment) - --a (pre-decrement) - a-- (post-decrement)
Fixed the following issues raised in code review: 1. Added validation to reject increment/decrement on literal numbers - Now correctly errors on expressions like `echo $(++2)` - Operators can only be applied to variables or parenthesized expressions 2. Replaced .unwrap() calls with proper error handling - Fixed unwrap() in unary_pre_arithmetic_expr (line 1738) - Fixed unwrap() in unary_post_arithmetic_expr (line 1783) - Used ok_or_else() with descriptive error messages 3. Fixed missing parse_variable_expansion function - Restored function that was accidentally removed during merge - Fixes compilation errors 4. Fixed stray conflict marker in types.rs - Removed leftover "<<<<<<< HEAD" marker All tests pass and manual testing confirms: - Post-increment (a++) returns original value, updates variable - Pre-increment (++a) returns new value, updates variable - Invalid expressions like ++2 correctly produce errors
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Trying to finish the PR using Claude